<?php
namespace Admin\Controller;

class WechatCarController extends AdminController
{
    public $community_db;
    public $community_news_db;
    public $services_db;
    public $service_step_db;
    public $service_image_db;
    public $car_db;

    public function __construct() {
        parent::__construct();

        $this->community_db = M('Community','zh_', 'DB_ZHCRM');
        $this->community_news_db = M("Community_news", 'tp_', 'DB_WX');
        $this->services_db = M("Qtservice",'tp_', 'DB_WX');
        $this->service_step_db = M("Qtservice_step",'tp_', 'DB_WX');
        $this->service_image_db = M("Qtservice_img",'tp_', 'DB_WX');
        $this->car_db = D('WxCar');
    }
    public function carList()
    {
        $data = $this->car_db->search(10);
        $this->assign('data',$data['data']);
        $this->assign('page',$data['page']);
        $this->display();
    }

    public function dumpExcel(){
        $data = D('WxuserInfo')->dumpExcel();
//        myDump($data);
    }

    public function carAudit(){
        $id = I('id');
        $status = I('status');
        $ok = $this->car_db->carAudit($id, $status);
        if($ok)
            $this->success('操作成功');
        else
            $this->error('操作失败');
    }
    //车辆删除
    public function carDel(){
        $id = I('id');
        $del = $this->car_db->delete($id);
        if ($del){
            $this->success("删除成功！");
        }else{
            $this->error("删除失败！");
        }
    }
}